package com.study.sbsummary.dao;

import com.study.sbsummary.model.Goods;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

// jpa实现
public interface GoodsDao extends JpaRepository<Goods,Long> {

    @Query("delete from Goods g where g.id=:id")
    void delById(Long id);

    List<Goods> findAll();

    @Query("select g from Goods g where g.id = :id")
    Goods selectById(Long id);
}
